package cyy.example.com.facotry.model.api.response;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Objects;

/**
 * Created by ChenYiYao on 2018/9/1.
 */
public class FirmNameByIdEntity implements Parcelable {
    public String companyId;
    public String companyName;

    //额外定义字段
    public boolean isSelect;

    public boolean isSelect() {
        return isSelect;
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }


    @Override
    public String toString() {
        return companyName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FirmNameByIdEntity that = (FirmNameByIdEntity) o;
        return Objects.equals(companyName, that.companyName);
    }

    @Override
    public int hashCode() {

        return Objects.hash(companyName);
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.companyId);
        dest.writeString(this.companyName);
        dest.writeByte(this.isSelect ? (byte) 1 : (byte) 0);
    }

    public FirmNameByIdEntity() {
    }

    protected FirmNameByIdEntity(Parcel in) {
        this.companyId = in.readString();
        this.companyName = in.readString();
        this.isSelect = in.readByte() != 0;
    }

    public static final Creator<FirmNameByIdEntity> CREATOR = new Creator<FirmNameByIdEntity>() {
        @Override
        public FirmNameByIdEntity createFromParcel(Parcel source) {
            return new FirmNameByIdEntity(source);
        }

        @Override
        public FirmNameByIdEntity[] newArray(int size) {
            return new FirmNameByIdEntity[size];
        }
    };
}
